from easycore.common.registry import Registry


class ModelFactory:
    registry = Registry("model")

    @classmethod
    def register(cls, model_type_name=None, obj=None):
        return cls.registry.register(model_type_name, obj)

    @classmethod
    def get(cls, model_config):
        model = cls.registry.get(model_config['architecture'])(model_config)
        return model
